package com.xyz.rok.tools.service;

import com.xyz.rok.tools.model.WxSubMsg;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @author ZhangYiXin
 * @version 1.0
 * @date 2021/4/13 18:22
 **/
@FeignClient(name = "weixin", url = "https://api.weixin.qq.com")
public interface WxAppService {

    @GetMapping("/sns/jscode2session")
    String code2Session(@RequestParam("appid") String appId, @RequestParam("secret") String secret, @RequestParam("js_code") String jsCode, @RequestParam("grant_type") String grantType);


    @GetMapping("/cgi-bin/token")
    String getAccessToken(@RequestParam("appid") String appId, @RequestParam("secret") String secret, @RequestParam("grant_type") String grantType);

    @GetMapping("/cgi-bin/user/info")
    String getUserInfo(@RequestParam("openid") String openId, @RequestParam("access_token") String accessToken);

    @PostMapping("/cgi-bin/message/subscribe/send")
    String pushMsg(@RequestParam("access_token") String accessToken, @RequestBody WxSubMsg wxSubMsg);
}
